import request from '@/utils/request'

export function listRole(data) {
    return request({
        url: '/system/sys-role/roleList',
        method: 'post',
        data
    })
}

export function getRole(roleId) {
    return request({
        url: '/system/sys-role/' + roleId,
        method: 'get'
    })
}

export function delRole(roleIds) {
    return request({
        url: '/system/sys-role/' + roleIds,
        method: 'delete'
    })
}

export function addRole(data) {
    return request({
        url: '/system/sys-role/addRole',
        method: 'post',
        data
    })
}

export function updateRole(data) {
    return request({
        url: '/system/sys-role/updateRole',
        method: 'put',
        data
    })
}

export function exportRole() {
    return request({
        url: '/system/sys-role/',
        method: ''
    })
}

export function dataScope(data) {
    return request({
        url: '/system/sys-role/dataScope',
        method: 'put',
        data
    })
}

export function changeRoleStatus(roleId, status) {
    const data = {
        roleId,
        status
    }
    return request({
        url: '/system/sys-role/changeStatus',
        method: 'put',
        data: data
    })
}

export function optionSelect() {
    return request({
        url: '/system/sys-role/optionSelect',
        method: 'get'
    })
}
